class Item {
    Position m_position;
    ArrayList m_innerItems; 
    Item(Position pos) {
        m_position = pos;
        m_innerItems = new ArrayList();
    }
        
    void draw(Position pos) {
        //On se dessine soit même
        drawItSelf(pos);
        //On dessine nos enfants
        for(int i=0; i<innerItems.size(); ++i) {
            
            innerItems.get(i).draw(Position.add(position,pos));
        }
    }
    
    void drawItSelf(Position pos) {}
}

class DrawingItem extends Item {
    ImageItem(Position pos) {
        super(pos);
    }
}

class ImageItem extends Item {
    PImage m_image;
    
    ImageItem(PImage i, Position pos) {
        super(pos);
        m_image = i;
    }
    
    void drawItSelf(Position pos) {
        image(m_image, m_position.m_x + pos.m_x, m_position.m_y + pos.m_y);
    }
}
    
class Position {
    int m_x, m_y;
    Position(int x, int y) {
        m_x = x;
        m_y = y;
    }
    
    static Position add(Position a, Position b) {
        return new Position(a.x+b.x,a.y+b.y);    
    }
    
    static Position sub(Position a, Position b) {
        return new Position(a.x-b.x,a.y-b.y);    
    }
}

class RoueItem extends DrawingItem {
    void drawItSelf(Position pos, float z) {
        pushMatrix();
        
        translateX(pos.x);
        translateY(pos.y);
        
        rotateZ(z);
        
        ellipse(m_position.x, m_position.y, 10, 10);
        
        popMatrix();
    }
    
    void draw(Position pos, Rotation rot) {
        
        drawItself(pos, rot);
        
        for(int i=0; j<super.innerItems.size(); ++i) {
            super.innerItems.get(i).draw(rotation);
        }
    }
}

class RayonItem extends RoueItem {
    void draw(Position pos, Rotation rot) {
        pushMatrix();
        
        translate
        
        popMatrix();
    }
}